package com.gmail.liulijuan.class6;

import java.util.ArrayList;

public class CreatArray {
	
	ArrayList aa=new ArrayList();
	
	
	
	public ArrayList CreatInt(int n) {
		for (int i = 0; i < 100; i++) {
		aa.add(i+1);
		}
		ArrayList bb=new ArrayList();
		for (int i = 0; i < n; i++) {
			double a=Math.random();
			double b=a*(100-i);
			int c=(int)b;
			bb.set(i, aa.get(c));
			aa.remove(c);
		}
		return bb;
	}
	
	public ArrayList CreatFloat(int n) {
		for (int i = 0; i < 100; i++) {
		aa.add(i+1);
		}
		ArrayList bb=new ArrayList();
		for (int i = 0; i < n; i++) {
			double a=Math.random();
			double b=a*(99-i);
			int c=(int)b;
			bb.set(i, aa.get(c));
			aa.remove(c);
		}
		return bb;
	}
	

	public ArrayList CreatInt2(int n) {
		for (int i = 0; i < n; i++) {
			double a=Math.random();
			double b=a*99+1;
			int c=(int)b;
			aa.add(c);
		}
	    return aa;
	}
}
